#ifndef BASICWINDOW_H
#define BASICWINDOW_H

#include <QDialog>
#include "TitleBar.h"

//namespace Ui {
//class BasicWindow;
//}

class BasicWindow : public QDialog
{
    Q_OBJECT

public:
    explicit BasicWindow(QWidget *parent = 0);
    ~BasicWindow();

public:
    //加载样式表
    void loadStyleSheet(const QString& sheetName);

    //获取原头像
    QPixmap getRoundImage(const QPixmap& src, QPixmap& mask, QSize masksize = QSize(0, 0));

private:
    //Ui::BasicWindowClass ui;
    void initBackGroundColor();//初始化背景

protected:
    void paintEvent(QPaintEvent*);				//绘制事件
    void mousePressEvent(QMouseEvent* event);	//鼠标点击事件
    void mouseMoveEvent(QMouseEvent* event);	//鼠标移动事件
    void mouseReleaseEvent(QMouseEvent*);		//鼠标松开事件

    void initTitleBar(ButtonType buttontype = MIN_BUTTON);		//初始化标题栏
    void setTitleBarTitle(const QString& title, const QString& icon = "");	//设置标题

public slots:
    void onShowClose(bool);			//关闭
    void onShowMin(bool);			//最小化
    void onShowHide(bool);			//隐藏
    void onShowNormal(bool);		//常态
    void onShowQuit(bool);			//退出
    void onSignalSkinChanged(const QColor& color);	//皮肤改变

    void onButtonMinClicked();		//最小化按钮
    void onButtonRestoreClicked();	//还原按钮
    void onButtonMaxClicked();		//最大化按钮
    void onButtonCloseClicked();	//关闭按钮；

protected:
    QPoint m_mousePoint;		//鼠标位置
    bool m_mousePressed;		//鼠标是否按下
    QColor m_colorBackGround;	//背景色
    QString m_styleName;		//样式文件名称
    TitleBar* m_titleBar;		//标题栏

//private:
//    Ui::BasicWindow *ui;
};

#endif // BASICWINDOW_H
